<template>
  <div class="container">
    <!-- <div class="header">
      <img src="../../assets/login/logoxhw.png" alt="" />
    </div> -->
    <div class="formBox">
      <div class="form-title">欢迎登录</div>
      <div class="form-subtitle">美欣达印染园区安全管理平台</div>
      <div class="formContent">
        <el-form ref="form" :model="form" label-width="0">
          <el-form-item class="formItem">
            <el-input v-model="form.account" placeholder="请输入用户名">
              <img src="@/assets/common/组 1.png" alt="" slot="prefix" />
            </el-input>
          </el-form-item>
          <el-form-item class="formItem">
            <el-input  type="password"  v-model="form.password" placeholder="请输入密码">
              <img src="@/assets/common/组 3.png" alt="" slot="prefix" />
            </el-input>
          </el-form-item>
          <el-form-item class="formItem">
            <el-button class="loginBtn" type="primary" @click="onSubmit"
              >立即登录</el-button
            >
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        account: '',
        password: '',
      },
    };
  },
  created() {},
  methods: {
  async  onSubmit() {
      const obj = {
        userName: this.form.account,
        password: this.form.password,
      }
      await this.$store.dispatch('user/storeLogin', obj)
      this.$router.push("/");
    },
  },
};
</script>

<style lang="scss" scoped>
.container {
  background-image: url("../../assets//login/最新2.png");
  background-size: cover;
  background-repeat: no-repeat;

  // height: 100vh;
  // width: 100vw;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  .header {
    position: absolute;
    left: 0;
    top: 24px;
    width: 480px;
    height: 80px;
    background: linear-gradient(90deg, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 0px 0px 0px 0px;
    padding: 22px 0 0 48px;
    img {
      width: 190px;
      height: 36px;
    }
  }
  .formBox {
    width: 600px;
    height: 688px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 3px 3px 3px #a7a6a6;
    position: fixed;
    right: 240px;
    top: 192px;
    padding: 40px 40px;
    .form-title {
      font-weight: bold;
      font-size: 32px;
      color: #313533;
      padding-left: 10px; /* 根据需要调整 */
      position: relative;
    }

    .form-title::before {
      content: "";
      display: block;
      width: 4px; /* 竖条的宽度 */
      height: 28px; /* 竖条的高度 */
      background-color: #0077FF; /* 竖条的颜色 */
      position: absolute;
      left: 0;
      transform: translateY(-50%); /* 向上移动自身高度的50% */
      top: 50%;
      border-radius: 2px 2px 2px 2px;
    }
    .form-subtitle {
      font-weight: 400;
      font-size: 28px;
      color: #313533;
      margin: 32px 0 42px;
    }
    .formContent {
      .el-form-item{
        margin-bottom: 32px;
      }
      ::v-deep .el-form-item__content {
        height: 64px;
      }
      ::v-deep .el-input__inner {
        height: 64px !important;
        line-height: 64px;
        padding-left: 40px;
      }
      img {
        margin-top: 15px;
        width: 32px;
        height: 32px;
      }
      .loginBtn {
        width: 504px;
        height: 64px;
        background: linear-gradient( 90deg, #00CBFF 0%, #006EFF 100%);
        border-radius: 4px 4px 4px 4px;
        border: none;
        font-weight: bold;
        font-size: 18px;
        color: #ffffff;
      }
    }
  }
}
</style>
<!-- <style lang="scss" scoped>
.container {
  display: flex;
  justify-content: flex-end;
  min-height: 100vh;
  background: url("../../assets/login/最新2.png") no-repeat center/cover;
  padding: 20px;
  position: relative;
  
  .formBox {
    width: clamp(300px, 90vw, 600px);
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: clamp(20px, 5vh, 40px);
    margin: auto 5%;
    position: relative;
    z-index: 1;

    .form-title {
      font-weight: bold;
      font-size: clamp(24px, 5vw, 32px);
      color: #313533;
      padding-left: 12px;
      position: relative;
      
      &::before {
        content: "";
        display: block;
        width: 4px;
        height: clamp(20px, 4vw, 28px);
        background-color: #0077FF;
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        border-radius: 2px;
      }
    }

    .form-subtitle {
      font-weight: 400;
      font-size: clamp(18px, 4vw, 28px);
      color: #313533;
      margin: clamp(16px, 3vh, 32px) 0 clamp(24px, 4vh, 42px);
    }

    .formContent {
      .el-form-item {
        margin-bottom: clamp(16px, 3vh, 32px);
      }
      
      ::v-deep .el-form-item__content {
        height: clamp(48px, 8vh, 64px);
      }
      
      ::v-deep .el-input__inner {
        height: clamp(48px, 8vh, 64px) !important;
        line-height: clamp(48px, 8vh, 64px);
        padding-left: 40px;
      }
      
      img {
        margin-top: clamp(8px, 1.5vh, 15px);
        width: clamp(24px, 4vw, 32px);
        height: clamp(24px, 4vw, 32px);
      }
      
      .loginBtn {
        width: 100%;
        height: clamp(48px, 8vh, 64px);
        background: linear-gradient(90deg, #00CBFF 0%, #006EFF 100%);
        border-radius: 4px;
        border: none;
        font-weight: bold;
        font-size: clamp(16px, 3vw, 18px);
        color: #ffffff;
      }
    }
  }
}

@media (max-width: 768px) {
  .container {
    justify-content: center;
    padding: 10px;
    
    &::before {
      width: 100%;
      background: rgba(255,255,255,0.9);
    }
    
    .formBox {
      margin: 0;
      box-shadow: none;
    }
  }
}

@media (max-height: 500px) {
  .formBox {
    max-height: 80vh;
    padding-top: 10px;
  }
}
</style> -->